from sqlalchemy import Column, String, DateTime, ForeignKey
from sqlalchemy.dialects.postgresql import UUID  # 导入PostgreSQL的UUID类型
from sqlalchemy.sql import func
from ..database import Base
import uuid

class Template(Base):  # 重命名为Template
    __tablename__ = 'templates'

    id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4, index=True)  # 使用UUID类型并设置默认值
    name = Column(String, nullable=False)
    content = Column(String, nullable=False)
    var = Column(String, nullable=False)
    created_at = Column(DateTime(timezone=True), server_default=func.now())
